<?php
	check_login();
	$a = getAction();
	$promoterId = $_SESSION['web_cadmin']['promoter_id'];
	
	switch ($a) 
	{
		case "index":
			
			$promoter = $db->getRow("select * from " . table("promoter") . " where id = '$promoterId'");
			if($_POST) {
				$password = trim($_POST["password"]);
				
				if(!$password) {
					errback("请输入密码");
					exit();
				}
				
				if(strlen($password) < 6 || strlen($password) > 20) {
					errback("密码请输入6到20位之间");
					exit();
				}
				
				if($password) {
					$promoter["password"] = $password;
				}
				
				$promoter["update_time"] = getNowTime();
				
				$db->update("promoter", $promoter, " and id = '$promoterId'");
				gourl();
			} else {
				$smarty->assign("promoter", $promoter);
				$smarty->display("passwordModify.html");
			}
			
			break;
	}

?>

